﻿using System.IO;
using System.Net;
using feather.attr;

namespace feather.unit
{
    public class HttpActionUnit
    {
        /// <summary>
        /// 通过uri获取网络数据
        /// </summary>
        /// <param name="uri">URI</param>
        /// <returns></returns>
        [ActionMethod]
        public object httpString(string uri)
        {
            WebRequest webRequest = WebRequest.Create(uri);
            WebResponse webResponse = webRequest.GetResponse();
            StreamReader streamReader = new StreamReader(webResponse.GetResponseStream());
            return streamReader.ReadToEnd(); ;
        }
    }
}
